#ifndef DLGSTRINGLISTEDITOR_H
#define DLGSTRINGLISTEDITOR_H

#include <ncsppt_export.h>
#include <QDialog>
#include "ui_dlgstringlisteditor.h"

class QStringListModel;

class DlgStringListEditor : public QDialog, private Ui::DlgStringListEditor
{
    Q_OBJECT
public:
    ~DlgStringListEditor();
    void setStringList(const QStringList &stringList);
    QStringList stringList() const;

    static QStringList getStringList(
        QWidget *parent, const QStringList &init = QStringList(), int *result = 0);

private slots:
    void on_upButton_clicked();
    void on_downButton_clicked();
    void on_newButton_clicked();
    void on_deleteButton_clicked();
    void on_valueEdit_textEdited(const QString &text);
    void currentIndexChanged(const QModelIndex &current, const QModelIndex &previous);
    void currentValueChanged();

private:
    DlgStringListEditor(QWidget *parent = 0);
    void updateUi();
    int currentIndex() const;
    void setCurrentIndex(int index);
    int count() const;
    QString stringAt(int index) const;
    void setStringAt(int index, const QString &value);
    void removeString(int index);
    void insertString(int index, const QString &value);
    void editString(int index);

    QStringListModel *m_model;
};


#endif // DLGSTRINGLISTEDITOR_H
